package aden.Generic;


public class GenViewDragTool extends GenViewTool
{
	public GenViewDragTool(Gen2DView inView)
	{
		super(inView);
		mIsDragging = false;
	}
	
	public boolean Init()
	{
		mIsDragging = false;
		return true;
	}
	
	public boolean OnTouchUp(float inX,
			                 float inY)
	{
		if (mIsDragging)
		{
			mLastX = inX;
			mLastY = inY;
			mIsDragging = false;
			return ProcessEnd(true);
		}
		return true;
	}
	
	public boolean OnTouchDown(float inX,
                               float inY)
	{
		if (mIsDragging)
		{
			return true;
		}
		mIsDragging = true;
		mFirstX = inX;
		mFirstY = inY;
		return true;
	}
		
	//to be overloaded
	public boolean ProcessEnd(boolean inIsValid)
	{
		return true;
	}
	
	protected float mFirstX;
	protected float mFirstY;
	protected float mLastX;
	protected float mLastY;
	protected boolean mIsDragging;
}